<?php
require_once('../phplib/include.inc.php');

class Home_Solution extends PageBase{
	public function Ini(){
		$this->GetSolutions();
		$this->GetContactInfo();
	}
	public function GetSolutions(){
		$db = getDb();
		$re = $db->fetch("SELECT b.cat_name,a.* FROM article AS a LEFT JOIN category AS b ON a.c_id=b.c_id WHERE a.a_del=0 AND b.cat_name='解决方案' ORDER BY a.a_id DESC");
		$this->assign("solutions",$re);
		
		$detail = array();
		for($i=0;$i<count($re);$i++){
			$detail[$i]['txt'] = $re[$i]['a_abstract'];
			$detail[$i]['img'] = $re[$i]['a_pic'];			
			$detail[$i]["a_title"] = $re[$i]["a_title"];
			$detail[$i]["a_id"] = $re[$i]["a_id"];
			
			$det = Util::GetImageAndTxt($re[$i]["a_content"]);
			if(strlen(trim($detail[$i]['txt'])) < 2) $detail[$i]['txt'] = $det['txt'];
			if(strlen(trim($detail[$i]['img'])) < 2) $detail[$i]['img'] = $det['img'];
		}
		$this->assign('article_detail',$detail);
	}
	public function GetContactInfo(){
		$db = getDb();
		$re = $db->fetchOne("SELECT * FROM subhome WHERE s_name='联系信息'");
		$this->assign("contactinfo",unserialize($re['s_content']));
	}
}
$a = new Home_Solution("file:".dirname(__FILE__)."/../home/solution.tpl.html");
$a->display();
?>